Repository navigation
Hash tables: choose with the generated table dispatchers - #4501
Merged
Merged
Conversation
`TableHash`'s `hash_table`, `md_hash_table` and `hmac_table` return the tables that `vg_hash_<h>_auto`, `vg_md_hash_<h>_auto` and `vg_hmac_<h>_auto` (`crate::arch::dispatch::fn_tables`) choose, instead of those of the implementation each hash's `Backend::select` chose in Rust. RSAES-OAEP's and RSASSA-PSS's `table::table` and `table::md_table`, the `HmacHash` trait and `ecdsa::table::sign_with` no longer take the CPU's features. `streaming_hash!` loses its `tables:` and the checks of their features, and `hashes::tables` its `Tables`. The choice is today's: the dispatchers rank the tables as the backends' `select`s did (SHA-NI, then AVX2 or AVX+BMI on x86-64; SHA2 or SHA3 on AArch64; SHA-NI on x86). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFuGsz7F32Tm9DLkuP
alex
enabled auto-merge
November 7, 2026 17:55
`hashes::tables::tests::table_words` now reads the tables the dispatchers choose, so the lines that choose among SHA-512's implementations (SHA512, and none) run it, to cover the choices of the SHA-512 family's tables of `Hmac` (SHA-512/224's and SHA-512/256's), which nothing else there reaches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHFuGsz7F32Tm9DLkuP
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hash functions' tables of functions, which RSAES-OAEP, RSASSA-PSS and deterministic ECDSA's signing pass to verified code, are now chosen by the generated table dispatchers (
crate::arch::dispatch::fn_tables, #4468), not by each hash'sBackend::selectin Rust.Changes
TableHash::hash_table,md_hash_tableandhmac_tablereturn the tables fromvg_hash_<h>_auto(),vg_md_hash_<h>_auto()andvg_hmac_<h>_auto(). They no longer take the CPU's features.oaep::table::table,pss::table::tableandpss::table::md_tabledrop theirFeaturesargument. RSA's ownfunctions(f)choice is unchanged (the coordinator's).HmacHash::hmac_tableandecdsa::table::sign_withdrop theirFeaturesargument, so the curves'signonly pass the signing function. The curves' choice of multiplication (Mul::select) is unchanged; ECDSA signing's migration builds on this.streaming_hash!loses itstables:section and the compile-time checks of the tables' features.hashes::tableslosesTables. Thetables:blocks of MD5, SHA-1 and SHA-2 are gone.hashes::tables::tests::table_wordschecks the words of the tables this CPU's dispatchers return. It no longer loops over each backend'sREQUIRES. EachVG_CPU_FEATURESline of CI that runs the full suite checks its own choice. The data words are the same for every table of an interface (VG.Rust.tableDispatcher).Behaviour
The choice is the same as before. The dispatchers rank the tables in the order the backends'
selects used:No TCB, Spec or Lean change; the generated crates are unchanged.
Benchmark
One scoped run (
rsa_oaep,rsa_pss,ecdsa_p256with SHA-256, x86-64, AArch64 and x86, all features andnone), against the merge base: https://github.com/pyca/verified-garbage/actions/runs/42397584348Checks
Static checksstepcargo fmt --checkcargo clippy --all-targets -D warningsfor x86-64 (with and withoutalloc), AArch64, i686, ARMv7, RISC-V 64 and PPC64LErfc6979,rfc7027, Wycheproof ECDSA, RSA-PSS and RSA-OAEP, run withVG_CPU_FEATURESunset and set tonone,sha,ssse3andavx,avx2,bmi1,bmi2Generated by Claude Code